package com.springboot.controller;

import com.springboot.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 唐文亮
 */
@RestController
public class UserController {
    @Autowired
    UserMapper userMapper;
    @RequestMapping("/login")
    public String login(){
        return "login";
    }
    @RequestMapping("/register")
    public String register(){
        Map<String,Object> params= new HashMap<String, Object>();
        params.put("username","TEST");
        params.put("password","TEST");
        params.put("nickname","TEST");
        boolean isR=userMapper.insertNewUser(params);
        if(isR){
            return "注册成功";
        }
        else{
            return "注册失败";
        }
    }
}
